package com.tybbank.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.tybbank.Bean.CateTypeBean;
import com.tybbank.R;

import java.util.List;

/*
* CREATE
*
* */
public class aaarAdapter extends BaseAdapter {
    private List<CateTypeBean> cateTypeBeans;
    private Context context;
    private static LayoutInflater inflater=null;
    public aaarAdapter(Context context, List<CateTypeBean> cateTypeBeans) {
        this.context = context;
        this.cateTypeBeans = cateTypeBeans;
    }


    @Override
    public int getCount() {
        return cateTypeBeans.size();
    }

    @Override
    public Object getItem(int i) {
        return cateTypeBeans.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if (view == null) {
            holder = new ViewHolder();
            inflater = LayoutInflater.from(context);
            view = inflater.inflate(R.layout.simple_spinner_item, null);
            holder.tv_bank = (TextView) view.findViewById(R.id.tv_bank);

            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();

        }
        holder.tv_bank.setText(cateTypeBeans.get(i).getname());
        return view;
    }

    static class ViewHolder {
        public TextView tv_bank, tv_name, tv_address, tv_discount;
    }
}
